package com.example.smart.room.factory

import androidx.room.Room
import com.example.lib.LibApp
import com.example.smart.room.MyDatabase
import com.example.smart.room.constants.SqlConstant
import com.example.smart.room.repository.AnimalRepository
import com.example.smart.room.repository.ReservationRepository
import kotlin.jvm.java

object RoomFactory {

    private val personDataBase by lazy {
        Room.databaseBuilder(LibApp.appContext, MyDatabase::class.java, SqlConstant.DATABASE_NAME).build()
    }

    fun createAnimalRepository(): AnimalRepository {
        return AnimalRepository(personDataBase.createAnimalDAO())
    }

    fun createReservationRepository(): ReservationRepository {
        return ReservationRepository(personDataBase.createReservationDAO())
    }

}